from django.urls import path

from . import views

urlpatterns = [
    # path('article/<int:id>/channel', views.ArticleView.as_view),

    # 获取全部文章列表
    path('article/-1/channel/', views.ArticlesAPIView.as_view()),

    # 获取某个频道之下的文章列表
    path('article/<int:id>/channel/', views.ArticleAPIView.as_view()),

    # 收藏或者取消收藏
    path('article/<int:id>/collect/', views.CollectedAPIView.as_view()),

    # 评论文章
    path('article/<int:pk>/publish_comment/', views.CommentPublishAPIView.as_view()),

    # 文章详情
    path('article/<int:pk>/', views.ArticleInfoAPIView.as_view()),

    # 根据关键字搜索文章
    path('articles/search/', views.ArticleSearchView.as_view()),

    # 发布文章
    path('article/', views.ArticlePostViewSet.as_view()),


    path('upload/common/', views.UploadImageView.as_view()),


]

from . import views
from rest_framework.routers import DefaultRouter

# 创建router实例
router = DefaultRouter()
# 注册路由
router.register('channels', views.ChannelView, basename='')
# 将router生成的路由追加到urlpatterns中
urlpatterns += router.urls
